//
//  XMGPlanView.m
//  码哥课堂
//
//  Created by yz on 2016/12/4.
//  Copyright © 2016年 yz. All rights reserved.
//

#import "XMGPlanView.h"
#import "XMGTimeItem.h"
#import "UIColor+Color.h"
@interface XMGPlanView ()
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *planCountLabel;

@end

@implementation XMGPlanView
- (void)setItem:(XMGTimeItem *)item
{
    _item = item;
    _timeLabel.text = item.startTime;
    _planCountLabel.text = [NSString stringWithFormat:@"%ld",item.plans.count];
    
    // 根据课程状态，设置显示颜色
    switch (item.status) {
        case 1: // 即将上课
            _timeLabel.backgroundColor = COLOR(37, 145, 235,1.0);
            break;
        case 2: // 正在上课
            _timeLabel.backgroundColor = [UIColor colorWithHexString:@"#fa562b"];
            break;
        case 3: // 已经完结课
            _timeLabel.backgroundColor = [UIColor colorWithHexString:@"#00ca80"];
            break;
        default:
            break;
    }
    
    
}
+ (instancetype)planView
{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
}

@end
